home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- *
- * NSSDC/CDF Header file for CDF distribution.
- *
- * Version 2.0, 2-Mar-92, ST Systems (STX)
- *
- * Modification history:
- *
- * V1.0 20-Jul-91, J Love Original version (for CDF V2.1).
- * V2.0 2-Mar-92, J Love IBM PC & HP-UX port. CDF V2.2.
- *
- ******************************************************************************/
-
- #if !defined(___cdfdist_h___)
- #define ___cdfdist_h___
-
- /*****************************************************************************
- * Definitions for misguided IBM PC compilers.
- *****************************************************************************/
-
- #if defined(MSDOS) /* For MicroSoft C */
- #define __MSDOS__
- #endif
-
- /******************************************************************************
- * System include files.
- ******************************************************************************/
-
- #if defined(unix)
- #include <sys/types.h>
- #endif
-
- #if defined(__MSDOS__)
- #include <sys\\types.h>
- #endif
-
- #if defined(vms)
- #include <types.h>
- #endif
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <time.h>
- #include <math.h>
-
- #if defined(__MSDOS__)
- #include <stdarg.h>
- #else
- #include <varargs.h>
- #endif
-
- /*****************************************************************************
- * Typedefs.
- *****************************************************************************/
-
- typedef int Boolean;
-
- #if defined(AIX) | defined(__MSDOS__)
- typedef signed char Schar;
- typedef signed char Byte;
- #else
- typedef char Schar;
- typedef char Byte;
- #endif
-
- typedef unsigned char Uchar;
-
- /******************************************************************************
- * Non-system include files.
- ******************************************************************************/
-
- #include "cdf.h"
- #include "dirutils.h"
- #include "qop.h"
- #include "epochu.h"
-
- /*****************************************************************************
- * ASCII characters.
- *****************************************************************************/
-
- #define NUL '\0' /* Null character. */
-
- /*****************************************************************************
- * Standards.
- *****************************************************************************/
-
- #define NSSDC_STANDARD 1 /* when TRUE (1), assume that all
- CDFs conform to NSSDC standard
- (by default) */
-
- /*****************************************************************************
- * Operating system dependent functions.
- *****************************************************************************/
-
- #if defined(__MSDOS__)
- #define EXIT_SUCCESS 0
- #define EXIT_FAILURE 1
- #define cfree free /* 'cfree' not available on IBM-PC */
- #define Exit exit(EXIT_SUCCESS)
- #define ExitBAD exit(EXIT_FAILURE)
- #endif
-
- #if defined(unix)
- #if !defined(memmove)
- #define memmove(dst,src,nbytes) bcopy(src,dst,nbytes)
- #endif
- #define Exit exit(0)
- #define ExitBAD exit(1)
- #endif
-
- #if defined(vms)
- #include <ssdef.h>
- #define Exit exit(SS$_NORMAL)
- #define ExitBAD exit(SS$_ABORT)
- #endif
-
- /*****************************************************************************
- * Machine dependent definitions.
- *****************************************************************************/
-
- #if defined(__MSDOS__)
- #define __IBMPC__ /* Used to check for IBM PC data encoding. */
- #endif
-
- #if defined(SunOS_403)
- #if !defined(toupper)
- #define toupper(c) ((c)&0x5F)
- #endif
- #endif
-
- /*****************************************************************************
- * Miscellaneous macros.
- *****************************************************************************/
-
- #define setbit(a,bit) (a = a | (1 << bit))
- #define clrbit(a,bit) (a = a & ~(1 << bit))
-
- #define bitset(a,bit) (a & (1 << bit))
- #define bitclr(a,bit) ( ! (a & (1 << bit)))
-
- #if !defined(Minimum)
- #define Minimum(a,b) ((a) < (b) ? (a) : (b))
- #endif
-
- #if !defined(Maximum)
- #define Maximum(a,b) ((a) > (b) ? (a) : (b))
- #endif
-
- #if !defined(TRUE)
- #define TRUE (-1)
- #endif
-
- #if !defined(FALSE)
- #define FALSE 0
- #endif
-
- #if !defined(SEEK_SET)
- #define SEEK_SET 0
- #endif
-
- #if !defined(SEEK_CUR)
- #define SEEK_CUR 1
- #endif
-
- #if !defined(SEEK_END)
- #define SEEK_END 2
- #endif
-
- /******************************************************************************
- * MACRO to check if a character string data type.
- ******************************************************************************/
-
- #define STRINGdataType(dataType) \
- (dataType == CDF_CHAR || dataType == CDF_UCHAR)
-
- /******************************************************************************
- * MALLOC macro.
- ******************************************************************************/
-
- #define MALLOC(ptr,size) { \
- ptr = (void *) malloc ((size_t) size); \
- if (ptr == NULL) { \
- printf ("Unable to allocate dynamic memory, halting...\n"); \
- ExitBAD; \
- } \
- }
-
- /******************************************************************************
- * nCHARACTERS macro. Outputs `n' of the specified character to a file pointer.
- ******************************************************************************/
-
- #define nCHARACTERS(fp,nChars,character) { \
- int _i_; \
- for (_i_ = 0; _i_ < nChars; _i_++) fprintf (fp,"%c",character); \
- }
-
- /******************************************************************************
- * Function prototypes.
- ******************************************************************************/
-
- #if defined(vms) | defined(__MSDOS__)
- void PageInst (char **);
- char PickDelim (char *);
- int ElemSize (long);
- int EncodeString (long, char *, char *);
- int EncodeValue (long, void *, char *);
- void WriteStringValue (FILE *, long, void *, int, int);
- void WriteEntryValue (FILE *, long, long, void *, int, int);
- char *EncodingToken (long);
- char *MajorityToken (long);
- char *FormatToken (long);
- char *ScopeToken (long);
- char *VarianceToken (long);
- char *TFvarianceToken (long);
- char *DataTypeToken (long);
- #endif
-
- #if defined(unix)
- void PageInst ();
- char PickDelim ();
- int ElemSize ();
- int EncodeString ();
- int EncodeValue ();
- void WriteStringValue ();
- void WriteEntryValue ();
- char *EncodingToken ();
- char *MajorityToken ();
- char *FormatToken ();
- char *ScopeToken ();
- char *VarianceToken ();
- char *TFvarianceToken ();
- char *DataTypeToken ();
- #endif
-
- /*****************************************************************************/
-
- #endif /*___cdfdist_h___*/
-